/// @tags: TreeChainPatiton
#include <algorithm>
#include <cctype>
#include <cstdio>
using std::swap;

namespace BlueQuantum {

int const N = 2e5 + 5;

template <typename T>
inline T &read(T &x) {
  x = 0;
  bool f = false;
  short ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = true;
    ch = getchar();
  }
  while (isdigit(ch)) x = x * 10 + (ch ^ '0'), ch = getchar();
  if (f) x = -x;
  return x;
}

struct Edge {
  int v, nxt;
} e[N << 1];

struct Node {
  int sum;
  bool tag;
} tr[N * 3];

int n, m, e_cnt, cnt;
int heads[N], ori[N], val[N], siz[N], dfn[N];

inline void add(int u, int v) { e[++e_cnt].v = v, e[e_cnt].nxt = heads[u], heads[u] = e_cnt; }

inline void pushup(int x) { tr[x].sum = (tr[x << 1].sum + tr[x << 1 | 1].sum); }

void build(int x = 1, int l = 1, int r = n) {
  if (l == r) { return tr[x].sum = val[ori[l]], void(); }
  int mid = (l + r) >> 1;
  build(x << 1, l, mid);
  build(x << 1 | 1, mid + 1, r);
  pushup(x);
}

inline void pushdown(int x, int l, int r) {
  if (tr[x].tag) {
    int mid = (l + r) >> 1;
    int ls = x << 1, rs = x << 1 | 1;
    tr[ls].sum = mid - l + 1 - tr[ls].sum;
    tr[rs].sum = r - mid - tr[rs].sum;
    tr[ls].tag ^= 1, tr[rs].tag ^= 1;
    tr[x].tag = 0;
  }
}

void modify(int L, int R, int x = 1, int l = 1, int r = n) {
  if (L <= l && r <= R) return tr[x].tag ^= 1, tr[x].sum = r - l + 1 - tr[x].sum, void();
  int mid = (l + r) >> 1;
  pushdown(x, l, r);
  if (L <= mid) modify(L, R, x << 1, l, mid);
  if (mid < R) modify(L, R, x << 1 | 1, mid + 1, r);
  pushup(x);
}

int query(int L, int R, int x = 1, int l = 1, int r = n) {
  if (L <= l && r <= R) return tr[x].sum;
  int mid = (l + r) >> 1, res = 0;
  pushdown(x, l, r);
  if (L <= mid) res += query(L, R, x << 1, l, mid);
  if (mid < R) res += query(L, R, x << 1 | 1, mid + 1, r);
  return res;
}

void dfs(int x) {
  ori[dfn[x] = ++cnt] = x, siz[x] = 1;
  for (int i = heads[x], v; i; i = e[i].nxt) {
    dfs(v = e[i].v);
    siz[x] += siz[v];
  }
}

inline int querySon(int x) { return query(dfn[x], dfn[x] + siz[x] - 1); }

inline void neg(int x) { modify(dfn[x], dfn[x] + siz[x] - 1); }

inline int main() {
  read(n);
  for (int i = 2, fa; i <= n; ++i) add(read(fa), i);
  for (int i = 1; i <= n; ++i) read(val[i]);
  dfs(1), build();
  char opt[4];
  read(m);
  for (int x; m; --m) {
    scanf("%s", opt);
    read(x);
    switch (opt[0]) {
      case 'g':
        printf("%d\n", querySon(x));
        break;
      case 'p':
        neg(x);
    }
  }
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("CF877E Danil and a Part-time Job.in", "r", stdin);
  freopen("CF877E Danil and a Part-time Job.out", "w", stdout);
#endif
#endif

  return BlueQuantum::main();
}